import request from "@/utils/request";

// 查询物料信息列表
export function getMaterialTestListApi(query, data) {
  return request({
    url: "/system/materialTest/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取物料列表
export function getMaterialListApi(query, data) {
  return request({
    url: "/system/material/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取所有物料列表
export function getallMaterialListApi(query, data) {
  return request({
    url: "/system/material/selectMaterialList",
    method: "post",
    params: query,
    data,
  });
}
// 获取物料列表（请购）
export function getMaterialRequestListApi(query, data) {
  return request({
    url: "/system/material/selectPurchaseMaterialList",
    method: "post",
    params: query,
    data,
  });
}

// 新增物料信息
export function addMaterialApi(data) {
  return request({
    url: "/system/material/add",
    method: "post",
    data,
  });
}

// 编辑物料信息
export function editMaterialApi(data) {
  return request({
    url: "/system/material/edit",
    method: "post",
    data,
  });
}

// 获取物料详情
export function getMaterialApi(materialId) {
  return request({
    url: "/system/material/getInfo",
    method: "get",
    params: { materialId },
  });
}

// 筛选物料列表
export function selectMaterialList(data) {
  return request({
    url: "/system/pub/autoCompleteMaterialList",
    method: "post",
    data,
  });
}

// 筛选物料列表
export function selectnewMaterialList(data) {
  return request({
    url: "/system/apply/selectMaterListAllBatch",
    method: "post",
    data,
  });
}
// 删除供应商
export function deleteMaterialApi(materialId) {
  return request({
    url: `/system/material/del`,
    method: "get",
    params: { materialId },
  });
}

// 获取采购单价变更记录
export function getPurchasePriceApi(materialId) {
  return request({
    url: `/system/material/selectPriceList`,
    method: "get",
    params: { materialId },
  });
}

// 修改采购订单完善物料
export function updatePurchaseOrderMaterial(data) {
  return request({
    url: `/system/orderInfo/updatePurchaseOrderMaterialInfo`,
    method: "post",
    data,
  });
}
